package com.cms.utils;

import com.cms.model.Result;
import com.cms.model.ResultCode;

import java.util.List;

public class ResultUtil {
    public static <T> Result<T> success (T data) {
        return new Result<T>(ResultCode.GENERAL_SUCCESS, "success", 1, data);
    }

    public static <T> Result<T> success (int count, T data) {
        return new Result<T>(ResultCode.GENERAL_SUCCESS, "success", count, data);
    }

    public static <T> Result<T> success() {
        return new Result<T>(ResultCode.GENERAL_SUCCESS, "success", 1,null);
    }

    public static <T> Result<T> success (String msg) {
        return new Result<T>(ResultCode.GENERAL_SUCCESS, msg, 1,null);
    }

    public static <T> Result<T> error() {
        return new Result<T>(ResultCode.GENERAL_ERROR, "error", 0,null);
    }

    public static <T> Result<T> error (String msg) {
        return new Result<T>(ResultCode.GENERAL_ERROR, msg, null);
    }


}
